package com.realife.mbplus.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @version V1.0
 * @author: Albert
 * @date: 2020/5/28 19:08
 * @description:
 */
@EnableTransactionManagement
@Configuration
@MapperScan("com.realife.mbplus.mapper")
public class MybatisPlusConfig {


    /**
     * mybatis-plus 乐观锁插件
     *
     * @return
     */
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }


    /**
     * 分页插件
     *
     * @return
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }


    /*@Bean //逻辑删除,新版本取消了这个配置, 性能监控在新版中被删除
    public ISqlInjector sqlInjector() {
        return new DefaultSqlInjector();
    }*/

}

